#pragma once

// 头文件
#pragma region .h
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#include <emscripten/bind.h>
#include <emscripten/val.h>
using namespace emscripten;
#endif
#pragma endregion

// PMeshManager
#pragma region PMeshManager
#ifdef __EMSCRIPTEN__
EMSCRIPTEN_BINDINGS(PMeshManager) {
	class_<PMeshManager>("PMeshManager")
		.class_function("createPMesh", &PMeshManager::createPMesh, allow_raw_pointers())
		.class_function("destroyPMesh", &PMeshManager::destroyPMesh)
		;
}
#endif
#pragma endregion

// BoolManager
#pragma region BoolManager
#ifdef __EMSCRIPTEN__
EMSCRIPTEN_BINDINGS(BoolManager) {
	class_<BoolManager>("BoolManager")
		.class_function("intersection", &BoolManager::intersection, allow_raw_pointers())
		.class_function("difference", &BoolManager::intersection, allow_raw_pointers())
		.class_function("unions", &BoolManager::intersection, allow_raw_pointers())
		;

}
#endif
#pragma endregion

// PMesh
#pragma region PMesh
#ifdef __EMSCRIPTEN__
EMSCRIPTEN_BINDINGS(PMesh) {
	class_<CorkTriMesh>("CorkTriMesh")
		.property("n_triangles", &CorkTriMesh::n_triangles)
		.property("n_vertices", &CorkTriMesh::n_vertices)
		;

	class_<PMesh, base<CorkTriMesh>>("PMesh")
		.function("toHandle", &PMesh::toHandle)
		.function("addVertices", &PMesh::addVertices, allow_raw_pointers())
		.function("addTriangles", &PMesh::addTriangles, allow_raw_pointers())
		.function("getIndexArray", &PMesh::getIndexArray, allow_raw_pointers())
		.function("getVetexArray", &PMesh::getVetexArray, allow_raw_pointers())
		;
}
#endif
#pragma endregion